<?php
require_once 'class/DataIn/AbstractDataIN.php';
require_once 'class/DataIn/AbstractDataIN.php';
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Time
 *
 * @author mateusz.ledzewicz
 */
class GrowthAverage extends AbstractDataIN{
    
    public static $shortAVG = 5;
    public static $longAVG  = 30;
    protected $dataArray;
    public function __construct($isin, $date, $type, $numberOfData) {
        parent::__construct($isin, $date, $type, $numberOfData+self::$longAVG);
    }


    protected function prepareData() {
      
        $data = $this->getPreparedData();
        $count = count($data);
        $this->dataArray = array_values($data);
        foreach($this->dataArray  as $key => $line){
            if($key < 1)
                continue;
            var_dump($this->dataInternet[0]);
            var_dump($line);
            var_dump($this->getIn(new Param(Param::typeGrow, Param::closePrice, 2), 0));exit;
            
           if($key+self::$longAVG>=$count)
                break;
                  
            $this->data[] = array($this->avg($key, self::$shortAVG), $this->avg($key, self::$longAVG) );  
        }
        
    }
    
    
    
    protected function avg($start, $numberOfElements)
    {   
        return $this->getValue($this->dataArray[$start]) - $this->getValue($this->dataArray[$start+$numberOfElements]);   
    }
}

?>
